'''
    1 默认等待时间
    2 强制等待时间
    3 获取input的value
    3 获取元素属性值


'''

from playwright.sync_api import sync_playwright


def handle_request(request):
    pass
    print('11', request.method, request.url)
    print()
def handle_response(response):
    print('22', response.status, response.url)
    print()

with sync_playwright() as p:
    browser = p.chromium.launch(headless=False)
    page = browser.new_page()

    # page.on('request', lambda request: print(1, request.method, request.url))
    # page.on('response', lambda response: print(2, response.status, response.url))
    page.on('request', handle_request)
    page.on('response', handle_response)
    page.goto('https://qzone.qq.com')



    page.wait_for_timeout(5000)
